body {
    background: linear-gradient(135deg, #e0e7ff 0%, #f8fafc 100%);
    font-family: 'Segoe UI', Arial, sans-serif;
    margin: 0;
    min-height: 100vh;
    background-image: repeating-linear-gradient(135deg, #e0e7ff22 0 2px, transparent 2px 40px), repeating-linear-gradient(45deg, #f8fafc11 0 2px, transparent 2px 40px);
}

.form-container {
    background: #fff;
    max-width: 1200px;
    margin: 48px auto 0 auto;
    padding: 36px 32px 32px 32px;
    border-radius: 18px;
    box-shadow: 0 8px 32px rgba(60, 72, 88, 0.13), 0 1.5px 6px rgba(60, 72, 88, 0.08);
    position: relative;
}

h2 {
    text-align: center;
    margin-bottom: 28px;
    color: #2d3a4a;
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: 1px;
}

form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem 0;
}

form label {
    display: block;
    margin-bottom: 7px;
    color: #374151;
    font-size: 15.5px;
    font-weight: 500;
    letter-spacing: 0.2px;
}

form label[for="firstname"]::before { content: "👤 "; }
form label[for="middlename"]::before { content: "👤 "; }
form label[for="lastname"]::before { content: "👤 "; }
form label[for="email"]::before { content: "✉️ "; }
form label[for="birthdate_day"]::before,
form label[for="birthdate_month"]::before,
form label[for="birthdate_year"]::before,
form label[for="birthdate_day"][data-en]::before { content: "🎂 "; }
form label[for="phone"]::before { content: "📞 "; }
form label[for="residence"]::before { content: "🏠 "; }
form label[for="country"]::before { content: "🌍 "; }
form label[for="region"]::before { content: "🗺️ "; }
form label[for="job"]::before { content: "💼 "; }
form label[for="level"]::before { content: "🎓 "; }
form label[for="cv"]::before { content: "📄 "; }
form label[for="nidaNumber"]::before { content: "🆔 "; }
form label[for="licenseType"]::before { content: "🪪 "; }

form input[type="text"],
form input[type="email"],
form input[type="tel"],
form input[type="file"],
form select {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 18px;
    border: 1.5px solid #cbd5e1;
    border-radius: 7px;
    font-size: 15.5px;
    background: #f9fafb;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    color: #22223b;
}

form input[type="file"] {
    padding: 7px 12px;
    background: #f1f5f9;
}

form input:focus,
form select:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 2px #6366f133;
}

form select {
    cursor: pointer;
}

form button {
    width: 100%;
    padding: 12px;
    background: linear-gradient(90deg, #6366f1 0%, #3b82f6 100%);
    color: #fff;
    border: none;
    border-radius: 7px;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
    box-shadow: 0 2px 8px rgba(99,102,241,0.08);
    transition: background 0.18s, transform 0.12s;
}

form button:hover {
    background: linear-gradient(90deg, #3b82f6 0%, #6366f1 100%);
    transform: translateY(-2px) scale(1.01);
}

#successMessage {
    margin-top: 22px;
    color: #22c55e;
    text-align: center;
    font-weight: bold;
    font-size: 1.1rem;
    letter-spacing: 0.2px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 7px;
    padding: 10px 0;
}

#nidaContainer,
#licenseTypeContainer {
    margin-bottom: 18px;
}

#regionContainer {
    margin-bottom: 18px;
}

.name-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 24px; /* further increased gap for more space */
    margin-bottom: 22px; /* more space below the name fields */
}
.name-grid > div {
    display: flex;
    flex-direction: column;
    gap: 10px; /* more vertical space between label and input */
}
.name-grid input[type="text"] {
    margin-bottom: 0 !important; /* remove default margin to rely on grid gap */
}

.country-select-wrapper {
    position: relative;
    margin-bottom: 18px;
}
.country-select-wrapper input[list] {
    padding-right: 36px;
}
.country-select-wrapper .country-icon {
    position: absolute;
    right: 12px;
    top: 36px;
    font-size: 1.2em;
    pointer-events: none;
    color: #6366f1;
}

#countryCode {
    min-width: 90px;
    padding-right: 0;
    margin-bottom: 0;
}
#phone {
    flex: 1 1 0%;
    margin-bottom: 0;
}

@media (max-width: 600px) {
    .form-container {
        padding: 10px 2vw 18px 2vw;
        max-width: 100vw;
        margin: 16px 0 0 0;
        border-radius: 10px;
        box-shadow: 0 4px 16px rgba(60, 72, 88, 0.10), 0 1px 3px rgba(60, 72, 88, 0.06);
    }
    h2 {
        font-size: 1.1rem;
        margin-bottom: 18px;
    }
    form button {
        font-size: 14px;
        padding: 10px;
        margin-top: 6px;
    }
    .name-grid {
        grid-template-columns: 1fr;
        gap: 16px; /* more gap on mobile */
        margin-bottom: 18px;
        background: #f3f4f6;
        border-radius: 8px;
        padding: 10px 6px 4px 6px;
    }
    .name-grid > div {
        gap: 8px;
    }
    .name-grid input[type="text"] {
        margin-bottom: 0 !important;
    }
    .modal-section {
        padding: 10px 8px 8px 8px;
        margin-bottom: 14px;
        margin-top: 6px;
        border-radius: 7px;
    }
    .modal-heading {
        font-size: 1rem;
        margin-bottom: 10px;
    }
    #languages {
        min-height: 60px;
        font-size: 14px;
    }
    form label {
        font-size: 14px;
        margin-bottom: 4px;
    }
    form input[type="text"],
    form input[type="email"],
    form input[type="tel"],
    form input[type="file"],
    form select {
        font-size: 14px;
        padding: 8px 8px;
        margin-bottom: 12px;
        border-radius: 5px;
    }
    .country-select-wrapper .country-icon {
        top: 28px;
        font-size: 1em;
    }
    #successMessage {
        font-size: 1rem;
        padding: 7px 0;
        margin-top: 14px;
    }
    #regionContainer,
    #nidaContainer,
    #licenseTypeContainer {
        margin-bottom: 12px;
    }
    form ul, form ol {
        font-size: 13px;
        margin-bottom: 10px;
    }
}

@media (max-width: 400px) {
    .form-container {
        padding: 4px 1vw 8px 1vw;
    }
    h2 {
        font-size: 0.98rem;
    }
    .modal-heading {
        font-size: 0.95rem;
    }
    form label {
        font-size: 13px;
    }
    form input[type="text"],
    form input[type="email"],
    form input[type="tel"],
    form select {
        font-size: 13px;
        padding: 7px 6px;
    }
}

/* Add subtle background pattern for visual appeal */
body {
    /* ...existing code... */
    background-image: repeating-linear-gradient(135deg, #e0e7ff22 0 2px, transparent 2px 40px), repeating-linear-gradient(45deg, #f8fafc11 0 2px, transparent 2px 40px);
    /* ...existing code... */
}

/* Add a soft border to inputs on mobile for clarity */
@media (max-width: 600px) {
    form input[type="text"],
    form input[type="email"],
    form input[type="tel"],
    form select {
        border: 1.2px solid #d1d5db;
        background: #f8fafc;
    }
}

form ul, form ol {
    margin: 0 0 18px 24px;
    padding: 0;
    color: #374151;
    font-size: 15px;
    line-height: 1.7;
}

form ul {
    list-style: disc inside;
}

form ol {
    list-style: decimal inside;
}

form li {
    margin-bottom: 6px;
}

.modal-section {
    border: 1.5px solid #cbd5e1;
    border-radius: 10px;
    background: #f8fafc;
    padding: 18px 18px 10px 18px;
    margin-bottom: 22px;
    margin-top: 8px;
}
.modal-heading {
    font-size: 1.13rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 16px;
    text-align: left;
}
#languages {
    min-height: 80px;
    margin-bottom: 8px;
}
.modal-section small {
    display: block;
    color: #64748b;
    font-size: 13px;
    margin-top: 2px;
    margin-bottom: 8px;
}

/* Spinner overlay styles */
#spinnerOverlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(245, 247, 255, 0.65);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.spinner {
    border: 6px solid #e0e7ff;
    border-top: 6px solid #6366f1;
    border-radius: 50%;
    width: 54px;
    height: 54px;
    animation: spin 1s linear infinite;
    box-shadow: 0 2px 12px #6366f133;
}
@keyframes spin {
    0% { transform: rotate(0deg);}
    100% { transform: rotate(360deg);}
}

/* Modal alert styles */
.modal-alert {
    position: fixed;
    z-index: 10000;
    left: 0; top: 0; width: 100vw; height: 100vh;
    background: rgba(30, 41, 59, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-alert .modal-content {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(60,72,88,0.18);
    padding: 32px 28px 22px 28px;
    min-width: 270px;
    max-width: 90vw;
    text-align: center;
    position: relative;
    animation: modalPop 0.22s cubic-bezier(.4,2,.6,1) both;
}
@keyframes modalPop {
    0% { transform: scale(0.85); opacity: 0;}
    100% { transform: scale(1); opacity: 1;}
}
.modal-alert .close-btn {
    position: absolute;
    top: 10px; right: 16px;
    font-size: 1.5rem;
    color: #64748b;
    cursor: pointer;
    font-weight: bold;
    transition: color 0.18s;
}
.modal-alert .close-btn:hover {
    color: #3b82f6;
}
#alertIcon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}
#alertMessage {
    font-size: 1.13rem;
    color: #374151;
    margin-bottom: 2px;
    margin-top: 2px;
    word-break: break-word;
}
.modal-alert.success #alertIcon { color: #22c55e; }
.modal-alert.error #alertIcon { color: #ef4444; }
.modal-alert.info #alertIcon { color: #3b82f6; }
.modal-alert.warning #alertIcon { color: #f59e42; }
